<?php
namespace UserApi\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;
class ChangepasswordApiController extends AbstractRestfulController
{
    public function getList()
    {			
			
    }
    public function get($user_id)
    {			
		
    }
    public function create($oldpassword)
    {
		
    }
    public function update($uid,$passwords)
    {
		header('Access-Control-Allow-Origin: *');	
		$userTable=$this->getServiceLocator()->get('Models\Model\UserFactory');
		$check_old_password = $userTable->getpassword($uid,$passwords['old_password'])->toarray();
		if(count($check_old_password)!=0){
			$change_password = $userTable->changepwd($uid,$passwords['cnf_password']);
			if($change_password==0 || $change_password==1){
				return new JsonModel(array(
					'value' 	=> '1',
				));
			}
		}else{
			return new JsonModel(array(
				'value' 	=> '0',
			));	
		}
    }
    public function delete($id)
    {
       
    }
}